﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LocationProspecting.aspx.cs" Inherits="House客户端.LocationProspecting" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>区位状况勘察页面</title>
    <link href="jquery-easyui-1.5.2/themes/default/easyui.css" rel="stylesheet" />
    <link href="easyui/css/wu.css" rel="stylesheet" />
    <link href="easyui/css/icon.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server"></form>
    <div class="easyui-panel" fit="true">
        <table>
            <tr>
                <td>小区四至-东至：</td>
                <td>
                    <input id="east" class="easyui-textbox" style="width: 100%; height: 25px" type="text" placeholder="请输入小区四至-东至" required /><span id="sp1" style="color: red"></span></td>
            </tr>
            <tr>
                <td>小区四至-南至：</td>
                <td>
                    <input id="south" class="easyui-textbox" type="text" style="width: 100%; height: 25px" placeholder="请输入小区四至-南至" required />
                    <span id="sp2" style="color: red"></span></td>
            </tr>
            <tr>
                <td>小区四至-西至：</td>
                <td>
                    <input id="west" class="easyui-textbox" type="text" style="width: 100%; height: 25px" placeholder="请输入小区四至-西至" required /><span id="sp3" style="color: red"></span></td>
            </tr>
            <tr>
                <td>小区四至-北至：</td>
                <td>
                    <input id="north" class="easyui-textbox" type="text" style="width: 100%; height: 25px" placeholder="请输入小区四至-北至" required /><span id="sp4" style="color: red"></span></td>
            </tr>
            <tr>
                <td>位置环绕：</td>
                <td>
                    <select id="Position" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择位置环绕"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>交通情况</td>
                <td>
                    <input type="text" class="easyui-textbox" required style="width: 100%; height: 25px" id="Traffic" placeholder="请输入交通情况" /><span id="sp5" style="color: red"></span></td>
            </tr>
            <tr>
                <td>交通便捷度：</td>
                <td>
                    <select id="Convenient" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择交通便捷度"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>自然人文环境情况</td>
                <td>
                    <input type="text" class="easyui-textbox" required id="Humanity" style="width: 100%; height: 25px" placeholder="自然人文环境情况" /><span id="sp6" style="color: red"></span></td>
            </tr>
            <tr>
                <td>自然人文环境质量：</td>
                <td>
                    <select id="Quality" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择自然人文环境质量"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>社区情况</td>
                <td>
                    <input type="text" class="easyui-textbox" required id="Community" style="width: 100%; height: 25px" placeholder="社区情况" /><span id="sp7" style="color: red"></span></td>
            </tr>
            <tr>
                <td>社区成熟情况：</td>
                <td>
                    <select id="Mature" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择社区成熟情况"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>基础设施配套情况</td>
                <td>
                    <input type="text" class="easyui-textbox" required style="width: 100%; height: 25px" id="Facilities" placeholder="社区情况" /><span id="sp8" style="color: red"></span></td>
            </tr>
            <tr>
                <td>基础设施配套度</td>
                <td>
                    <select id="Degree" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择社区成熟情况"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>配套设施</td>
                <td>
                    <select id="Supporting" class="easyui-combobox" required style="width: 800px;">
                        <option value="请选择设施配套度"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>有关说明</td>
                <td>
                    <textarea id="Explain" class="easyui-textbox" required style="width: 800px;"></textarea><span id="sp9" style="color: red"></span></td>
            </tr>
            <tr>
                <td>勘察时间</td>
                <td>
                    <input id="time" class="easyui-textbox" required type="date" style="width: 800px;" />
                </td>
            </tr>
            <tr>
                <td>
                    <button onclick="funbao()">保存</button></td>
            </tr>
        </table>
    </div>
    <script src="jquery-easyui-1.5.2/jquery.min.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
    <script src="jquery-easyui-1.5.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="jquery-easyui-1.5.2/easyloader.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.params.js"></script>
    <script src="jquery-easyui-1.5.2/Common.js"></script>
    <script>
        //绑定位置环绕
        Position();
        function Position() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "位置环绕" + "&i=" + 42,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Position").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定交通便捷度
        Convenient();
        function Convenient() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "交通便捷度" + "&i=" + 2,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Convenient").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定自然人文环境质量
        Quality();
        function Quality() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "自然人文环境" + "&i=" + 3,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Quality").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定社区成熟情况
        Mature();
        function Mature() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "居住社区成熟度" + "&i=" + 4,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Mature").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定基础设施配套情况
        Degree();
        function Degree() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "基础设施配套情况" + "&i=" + 5,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Degree").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        //绑定配套设施
        Supporting();
        function Supporting() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/Dictionary/?type=" + "配套设施" + "&i=" + 6,
                success: function (obj) {
                    obj = eval(obj);
                    $("#Supporting").combobox({
                        editable: false,
                        data: obj,
                        valueField: "ID",
                        textField: 'Dictionary_Name'
                    });
                }
            })
        }
        function funbao() {
            var ProjectNumber = $.query.get("ProjectNumber");
            var east = $("#east").val();
            if (east == "" || east == null) {
                $("#span1").html("不能为空");
                return;
            }
            else {
                $("#span1").html("");
            }
            var south = $("#south").val();
            if (south == "" || south == null) {
                $("#span2").html("不能为空");
                return;
            }
            else {
                $("#span2").html("");
            }
            var west = $("#west").val();
            if (west == "" || west == null) {
                $("#span3").html("不能为空");
                return;
            }
            else {
                $("#span3").html("");
            }
            var north = $("#north").val();
            if (north == "" || north == null) {
                $("#span4").html("不能为空");
                return;
            }
            else {
                $("#span4").html("");
            }
            var Position = $('#Position').combobox('getValue');
            var Traffic = $("#Traffic").val();
            if (Traffic == "" || Traffic == null) {
                $("#span5").html("不能为空");
                return;
            }
            else {
                $("#span5").html("");
            }
            var Convenient = $('#Convenient').combobox('getValue');
            var Humanity = $("#Humanity").val();
            if (Humanity == "" || Humanity == null) {
                $("#span6").html("不能为空");
                return;
            }
            else {
                $("#span6").html("");
            }
            var Quality = $('#Quality').combobox('getValue');
            var Community = $("#Community").val();
            if (Community == "" || Community == null) {
                $("#span7").html("不能为空");
                return;
            }
            else {
                $("#span7").html("");
            }
            var Mature = $('#Mature').combobox('getValue');
            var Facilities = $("#Facilities").val();
            if (Facilities == "" || Facilities == null) {
                $("#span8").html("不能为空");
                return;
            }
            else {
                $("#span8").html("");
            }
            var Degree = $('#Degree').combobox('getValue');
            var Supporting = $('#Supporting').combobox('getValue');
            var Explain = $("#Explain").val();
            if (Explain == "" || Explain == null) {
                $("#span9").html("不能为空");
                return;
            }
            else {
                $("#span9").html("");
            }
            var time = $("#time").val();
            $.ajax({
                type: "post",
                url: WebApiURL + "api/Values/Post",
                data: {
                    ProjectNumber: ProjectNumber,
                    Location_East: east,
                    Location_West: west,
                    Location_North: north,
                    Location_South: south,
                    Location_Position: Position,
                    Location_Traffic: Traffic,
                    Location_Convenient: Convenient,
                    Location_Humanity: Humanity,
                    Location_Quality: Quality,
                    Location_Community: Community,
                    Location_Mature: Mature,
                    Location_Facilities: Facilities,
                    Location_Degree: Degree,
                    Location_Supporting: Supporting,
                    Location_Explain: Explain,
                    Location_CreateTime: time,
                    Location_CreatePeople: 'admin'
                },
                success: function (obj) {
                    if (obj > 0) {
                        $.messager.alert("保存成功");
                        location.href = 'ProspectingList.aspx';
                    }
                    else {
                        $.messager.alert("保存失败");
                        location.href = 'LocationProspecting.aspx';
                    }
                }
            })
        }
    </script>
</body>
</html>
